Repository navigation
Conversation
TerrainInfo::getLiquidStatus took the highest liquid in the column under a point and only checked it against the floor the point stands on. The ADT liquid goes into that column whatever its height, so in a city or a cave below the surface the tile's water counted as water the player stands in, however far above the ceiling it was. In the Undercity Rogues' Quarter, at the rogue trainer (1418, 58, -62), the column holds Tirisfal's ADT water at 32.93 -- under its own terrain at 34.14 and about 95 yards above the floor. Every player there gets a breath timer and drowns once it runs out (60s, four times that for Undead). The GridMap::getLiquidStatus this replaced judged ADT liquid against the ADT terrain at the point: no liquid when the level is below that terrain, or the point is more than 2 yards under it. Carry the terrain height with the ADT liquid (LiquidInfo / Surface terrainZ; none over a hole or for a model's liquid, as INVALID_HEIGHT made it before) and select with Column::LiquidFor(z), which skips an ADT liquid that does not reach the point. getLiquidStatus and mangos-height-check use it; GetTerrainType, which has no z, keeps HighestLiquid.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the height-aware liquid-selection change.
No open issues 🎉
What changed in this PR
This PR prevents ADT surface water from affecting players beneath its terrain, addressing unintended drowning in underground areas such as the Undercity Rogues’ Quarter.
Changes:
- Carries ADT terrain height with liquid data and adds height-aware liquid selection.
- Uses the new selector in gameplay liquid checks and height-check diagnostics, while preserving
HighestLiquidfor callers without a height. - Adds five regression tests covering buried points, terrain boundaries, holes, and model liquids.
| File | Description |
|---|---|
src/tools/height-check/HeightCheck.cpp |
Reports liquid using the queried point’s height. |
src/tests/TerrainModelTest.cpp |
Adds five liquid-selection regression tests. |
src/shared/terrain/Terrain.hpp |
Adds optional terrain height to liquid data. |
src/shared/terrain/FusedTerrain.cpp |
Attaches terrain height to ADT liquid samples. |
src/shared/terrain/Column.hpp |
Preserves terrain metadata and adds LiquidFor(z) filtering. |
src/game/WorldHandlers/GridMap.cpp |
Uses height-aware selection for gameplay liquid status. |
Review effort: Balanced
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 13 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TerrainInfo::getLiquidStatustook the highest liquid in the column under a point and only checked it against the floor the point stands on. The ADT liquid goes into that column whatever its height, so in a city or a cave below the surface the tile's water counted as water the player stands in, however far above the ceiling it was.In the Undercity Rogues' Quarter, at the rogue trainer (1418, 58, -62), the column holds Tirisfal's ADT water at 32.93 -- under its own terrain at 34.14 and about 95 yards above the floor. Every player there gets a breath timer and drowns once it runs out (60s, four times that for Undead).
The
GridMap::getLiquidStatusthis replaced judged ADT liquid against the ADT terrain at the point: no liquid when the level is below that terrain, or the point is more than 2 yards under it. Carry the terrain height with the ADT liquid (LiquidInfo/SurfaceterrainZ; none over a hole or for a model's liquid, asINVALID_HEIGHTmade it before) and select withColumn::LiquidFor(z), which skips an ADT liquid that does not reach the point.getLiquidStatusandmangos-height-checkuse it;GetTerrainType, which has no z, keepsHighestLiquid.Verification
src/tests/TerrainModelTest.cpp(behindWITH_TESTS).mangos-height-check --verboseon the baked tiles: the trainer's spots now reportliquid=none(werewater@32.93); the lake beside them (1307, 15) still reports water from its bed to its surface, as before.git diff --checkclean.This change is